package com.dell.xiaodaiyu.demo.controller;

import com.dell.xiaodaiyu.demo.service.WeatherService;
import com.dell.xiaodaiyu.demo.vo.WeatherRespon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
     * @Author dell
     * @Description //TODO
     * @Date 22:26 2018/11/12
     * @ClassName WeatherController
     * @Version  V1,0
  **/
 @RestController
 @RequestMapping("/weather")
public class WeatherController {

     @Autowired
     private WeatherService weatherService;
     @GetMapping("/cityId/{cityId}")
     public WeatherRespon getWeatheByid(@PathVariable(value = "cityId")String cityId){
         return weatherService.getWeatherByCityId(cityId);
     }

    @GetMapping("/cityName/{cityName}")
    public WeatherRespon getWeatheByName(@PathVariable(value = "cityName")String cityName){
        return weatherService.getWeatherByCityName(cityName);
    }

 }
